<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>随访记录</title>
    <%- include('../_global/baseLibsJKDA') %>
    <link rel="stylesheet" href="/static/css/jkda/public.css"/>
    <link rel="stylesheet" href="/static/css/jkda/page-main.css"/>
    <!--<link rel="stylesheet" href="/static/css/public.css">-->
<style type="text/css">
html,body {
	width: 100%;
	height: 100%;
	margin: 0px;
}
#ListTabBox .tab{ display: block!important;}
</style>


</head>

<body>
  <!-- <div class="search-nav">
    <i class="search"></i>
    <input type="text" placeholder="输入检查单号" id="JCDH" onkeyup="filterContent()">
  </div> -->
  <div id="ListTabBox">
    <div class="tab"> <div class="mz-list"  >
      <ul id= "sfjl" ></ul></div></div>
  </div> 
</body>

<script type="text/javascript">

    var page_sfjl = (function($, page_sfjl) {

        function indata(){
            var zxwyh = $.QuickUrlUtils.getRequest("ZXWYH");
            $.QuickRemote.AjaxJson(goal_jkda_service+"/jkda/queryJkdaMbda", page_sfjl.queryJkdaMbdaBack,{ZXWYH: zxwyh});
        }

        //慢病档案回调
        function queryJkdaMbdaBack(result){
            page_sfjl.appendToSfjl(result);
        }
        function sortNumber(a,b) {
            return b - a;
        }


        //创建随访记录信息
        function appendToSfjl(result){
            var lis = [];
            if(result.length != 0){
                var sfjlBak =result.sort(page_sfjl.sortNumber);
                $(sfjlBak).each(function(index){
                    var num = index;
                    if(this["YWLX"] == "B0401a"){
                        var ywzys = this["YWZY"].split("%|%");
                        var sfjl = ywzys[1].split("}|{");
                        var sfjls = sfjl[0].split("^|^");

                        var sfrq = sfjls[0];
                        var sffs = sfjls[1];
                        var mqzz = sfjls[2];
                        var sfy = sfjls[3];
                        var szy = sfjls[4];
                        var bfz = sfjls[5];
                        var li= $("<li>");
                        var div = $("<a>");
                        div.attr("class", "li-box");

                        var div1 = $("<div>");
                        div1.attr("class", "black-block");
                        var span1 = $("<span>");
                        span1.html("随访时间：" );
                        span1.appendTo(div1);
                        var span2 = $("<span>");
                        var str;
                        var date;
                        if(StringUtils.isEmpty(sfrq)){
                            str = sfrq;
                        }else{
                            date = new Date(sfrq.replace(/(\d{4})(\d{2})(\d{2})/g,'$1-$2-$3'));
                            str = date.Format("yyyy-MM-dd");
                        }
                        span2.html(str);
                        //span2.html(sfrq);
                        span2.appendTo(div1);
                        div1.appendTo(div);

                        var div2 = $("<div>");
                        div2.attr("class", "black-block");
                        var span3 = $("<span>");
                        span3.html("随访方式：" );
                        span3.appendTo(div2);
                        var span4 = $("<span>");
                        span4.html(sffs);
                        span4.appendTo(div2);
                        div2.appendTo(div);

                        var div3 = $("<div>");
                        div3.attr("class", "black-block");
                        var span5 = $("<span>");
                        span5.html("目前症状：" );
                        span5.appendTo(div3);
                        var span6 = $("<span>");
                        span6.html(mqzz);
                        span6.appendTo(div3);
                        div3.appendTo(div);

                        var div5 = $("<div>");
                        div5.attr("class", "black-block");
                        var span9 = $("<span>");
                        span9.html("收缩压：" +sfy);
                        span9.appendTo(div5);
                        var span11 = $("<span>");
                        span11.attr("class", "black-span");
                        span11.html("舒张压：" +szy);
                        span11 .appendTo(div5);
                        div5.appendTo(div);


                        var div4 = $("<div>");
                        div4.attr("class", "black-block");
                        var span7 = $("<span>");
                        span7.html("并发症：" );
                        span7.appendTo(div4);
                        var span8 = $("<span>");
                        span8.html(bfz);
                        span8.appendTo(div4);
                        div4.appendTo(div);

                        div.data("info",result[num]["YWZY"]);
                        div.on("click",function(){
                            var info = $(this).data("info");
                            info.split();
                            StoreCache.setCache("jkdaSfjlCache", info+"^^gxy");
                            $.QuickUrlUtils.redirectJSBridge({url:jkda_view+"/sfjl/sfjlDetail.ejs", title:"随访记录详情"});
                        });
                        div.appendTo(li);

                        lis.push(li);
                    }else if(this["YWLX"] == "B0402a"){
                        var ywzys = this["YWZY"].split("%|%");
                        var sfjl = ywzys[1].split("}|{");
                        var sfjls = sfjl[0].split("^|^");

                        var sfrq = sfjls[0];
                        var sffs = sfjls[1];
                        var kfxt = sfjls[2];
                        var sjxt = sfjls[3];
                        var ntl = sfjls[4];
                        var chlxsxt = sfjls[5];
                        var lczz = sfjls[6];
                        var li= $("<li>");
                        var div = $("<a>");
                        div.attr("class", "li-box");

                        var div1 = $("<div>");
                        div1.attr("class", "black-block");
                        var span1 = $("<span>");
                        span1.html("随访时间：" );
                        span1.appendTo(div1);
                        var span2 = $("<span>");
                        var str;
                        var date;
                        if(StringUtils.isEmpty(sfrq)){
                            str = sfrq;
                        }else{
                            date = new Date(sfrq.replace(/(\d{4})(\d{2})(\d{2})/g,'$1-$2-$3'));
                            str = date.Format("yyyy-MM-dd");
                        }
                        span2.html(str);
                        //span2.html(sfrq);
                        span2.appendTo(div1);
                        div1.appendTo(div);

                        var div2 = $("<div>");
                        div2.attr("class", "black-block");
                        var span3 = $("<span>");
                        span3.html("随访方式：" );
                        span3.appendTo(div2);
                        var span4 = $("<span>");
                        span4.html(sffs);
                        span4.appendTo(div2);
                        div2.appendTo(div);

                        var div3 = $("<div>");
                        div3.attr("class", "black-block");
                        var span5 = $("<span>");
                        span5.html("空腹血糖：" );
                        span5.appendTo(div3);
                        var span6 = $("<span>");
                        span6.html(kfxt);
                        span6.appendTo(div3);
                        div3.appendTo(div);

                        var div4 = $("<div>");
                        div4.attr("class", "black-block");
                        var span7 = $("<span>");
                        span7.html("餐后两小时血糖：" );
                        span7.appendTo(div4);
                        var span8 = $("<span>");
                        span8.html(chlxsxt);
                        span8.appendTo(div4);
                        div4.appendTo(div);

                        var div5 = $("<div>");
                        div5.attr("class", "black-block");
                        var span9 = $("<span>");
                        span9.html("随机血糖：" );
                        span9.appendTo(div5);
                        var span10 = $("<span>");
                        span10.html(sjxt);
                        span10.appendTo(div5);
                        div5.appendTo(div);

                        var div6 = $("<div>");
                        div6.attr("class", "black-block");
                        var span11 = $("<span>");
                        span11.html("耐糖量：" );
                        span11.appendTo(div6);
                        var span12 = $("<span>");
                        span12.html(ntl);
                        span12.appendTo(div6);
                        div6.appendTo(div);

                        var div7 = $("<div>");
                        div7.attr("class", "black-block");
                        var span13 = $("<span>");
                        span13.html("临床症状：" );
                        span13.appendTo(div7);
                        var span14 = $("<span>");
                        span14.html(lczz);
                        span14.appendTo(div7);
                        div7.appendTo(div);

                        div.data("info",result[num]["YWZY"]);
                        div.on("click",function(){
                            var info = $(this).data("info");
                            info.split();
                            StoreCache.setCache("jkdaSfjlCache", info+"^^tnb");
                            $.QuickUrlUtils.redirectJSBridge({url:jkda_view+"/sfjl/sfjlDetail.ejs", title:"随访记录详情"});
                        });
                        div.appendTo(li);

                        lis.push(li);
                    }
                });
            }else{
                var li= $("<li>");
                var div0 = $("<div>");
                div0.attr("class", "black-block");

                div0.attr("style","width:100%;text-align:center; font-weight:bold;color:#000;padding-top:20px");
                div0.html("暂无信息");

                div0.appendTo(li);

                lis.push(li);
            }
            $("#sfjl").html(lis);
        }
        var cfg_def = {
            indata: indata,
            queryJkdaMbdaBack: queryJkdaMbdaBack,
            sortNumber: sortNumber,
            appendToSfjl: appendToSfjl,
        }

        page_sfjl.init = function(cfg){
            $.extend(page_sfjl, cfg_def, cfg);
            page_sfjl.indata();

        }

        return page_sfjl;
    })(jQuery, {});
    


</script>
</html>